package com.lenovo.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.lenovo.dao.BaseDAO;
import com.lenovo.model.SdbB2cComments;
import com.lenovo.service.B2cCommentService;
@Repository
public class B2cCommentServiceImpl implements B2cCommentService{
	@SuppressWarnings("rawtypes")
	@Resource
	private BaseDAO dao ;
	
	@Override
	public boolean save(SdbB2cComments b2c) {
		boolean status = false;
		try{
			dao.save(b2c);
			status = true;
		}catch(Exception ex){
			ex.printStackTrace();
		}	
		return status;
	}

	@Override
	public String loadbyCrateTime() {
		String time ="0" ;
		try{
			SdbB2cComments comment=	(SdbB2cComments) dao.loadObject("from SdbB2cComments order by id desc limit 1");
			if(comment!=null){
				time=comment.getCreatetime() ;
			}
			
		    
		}catch(Exception ex){
			ex.printStackTrace();
		}	
		return time;
	}

}
